/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, {Component} from 'react';
import DataStore from '../expand/dao/DataStore';
import {
    SafeAreaView,
    ScrollView,
    StyleSheet,
    View,
    Text,
    StatusBar,
    TextInput,
    Button,
    AsyncStorage
} from 'react-native';

import {
    Header,
    LearnMoreLinks,
    Colors,
    DebugInstructions,
    ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

type Props = {};
export default class AsyncStorageDemoPage extends Component<Props> {

    constructor(props) {
        super(props);
        this.state = {
            showText: ''
        }
        this.dataDtore = new DataStore();
    }
    render() {
        return (
            <View style={styles.container}>
                <Text style={styles.welcome}>FavoritePage</Text>
                <TextInput
                    style={styles.input}
                    onChangeText={text=>{
                        this.value = text;
                    }}
                />
                <View style={styles.input_container}>
                    <Text onPress={() => {
                        this.doSave()
                    }}>Save</Text>
                    <Text onPress={() => {
                        this.doRemove()
                    }}>Remove</Text>
                    <Text onPress={() => {
                        this.doGet()
                    }}>Get</Text>
                </View>

                <Text>{JSON.stringify(this.state.showText)}</Text>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    input:{
        height: 30,
        flex: 1,
        borderColor: 'black',
        borderWidth:1,
        marginRight: 10
    },
    input_container: {
        flexDirection: 'row',
        alignItems: 'center'
    }
});

// export default App;
